<?
include('../json/header_table.php');
?> $("#flex1").flexigrid({
url: 'mst_guru_json.php',
dataType: 'json',
colModel : [
{display: ' Edit', name : 'edit', width : 100, sortable : false, align: 'center'},
{display: ' Delete', name : 'delete', width : 100, sortable : false, align: 'center'},
{display: ' Kd Guru', name : 'kd_guru', width : 100, sortable : true, align: 'center'},
{display: ' Nm Guru', name : 'nm_guru', width : 100, sortable : true, align: 'center'},
{display: ' Alamat', name : 'alamat', width : 100, sortable : true, align: 'center'},
{display: ' Tmpt Lahir', name : 'tmpt_lahir', width : 100, sortable : true, align: 'center'},
{display: ' Tgl Lahir', name : 'tgl_lahir', width : 100, sortable : true, align: 'center'},
{display: ' Tgl Masuk', name : 'tgl_masuk', width : 100, sortable : true, align: 'center'},
{display: ' Email', name : 'email', width : 100, sortable : true, align: 'center'},
{display: ' Nohp', name : 'nohp', width : 100, sortable : true, align: 'center'},
{display: ' Jenkel', name : 'jenkel', width : 100, sortable : true, align: 'center'},
{display: ' Foto', name : 'foto', width : 100, sortable : true, align: 'center'},
{display: ' Agama', name : 'agama', width : 100, sortable : true, align: 'center'}

],
buttons : [
{name: 'Add', bclass: 'add', onpress : Add},
{separator: true}
],
searchitems : [
{display: 'ISO', name : 'iso'},
{display: 'Name', name : 'name', isdefault: true}
],
sortname: "kd_guru",
sortorder: "asc",
usepager: true,
title: 'mst_guru',
useRp: true,
rp: 15,
showTableToggleBtn: true,
width: 890,
onSubmit: addFormData,
height: 200
}); //This function adds paramaters to the post of flexigrid. You can add a verification as well by return to false if you don't want flexigrid to submit
function addFormData(){
//passing a form object to serializeArray will get the valid data from all the objects, but, if the you pass a non-form object, you have to specify the input elements that the data will come from
var dt = $('#sform').serializeArray();
$("#flex1").flexOptions({params: dt});
return true;
}
$('#sform').submit(function (){
$('#flex1').flexOptions({newp: 1}).flexReload();
return false;
});
function Add()
{
popUp('add_guru.php');
}
function openPop(a,kode)
{
popUp(a+"?kode="+kode);
}
function hapus_data(kode)
{
var konfirmasi;
konfirmasi=confirm('Anda ingin menghapus data ini');
var url='hapus_data_mst_guru.php';
if(konfirmasi){
$.ajax({
type: "POST",
url: url,
data: {kode:kode},
success: function (data)
{
if(data==1)
{
alert('sukses hapus');
location.reload();
}
}
//dataType: dataType
});
}
}
function Delete()
{
alert('Delete');
}
<? //============================= Button ============================
include('../json/footer_table.php');
?> 